package cn.edu.fudan.autoparser;
import java.io.IOException;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

public class XCarAutoHTMLParser extends AutoHTMLParser {

	public XCarAutoHTMLParser(String basicURL, String subURL) {
		super(basicURL, subURL);
	}

	@Override
	public void getHTML() throws IOException {
		Document doc = null;
		doc=Jsoup.connect(basicURl+subURL).get();
		Elements elements=doc.getElementsByClass("page_about_right");
		if(elements.size()>0){
			String newURL=elements.get(0).attr("href");
			doc=Jsoup.connect(newURL).get();
		}
		HTML=doc;
	}

	@Override
	public void parseHTML() {
		Elements metas=HTML.getElementsByTag("meta");
		Element content = HTML.getElementById("newsbody");
		this.tiltle=metas.get(1).attr("content");
		this.content=content.text();
	}

}
